﻿@{
    ViewBag.zhanghuguanli = "active";
    ViewBag.Title = "酒店账户";
    Layout = "~/Views/Shared/_layout_jiudian.cshtml";
}

<div class="sousuo">
    <div class="new_user">
        <button class="new_btn" onclick="to_url('/JiuDian/JDZhangHuShow');"> 新建子账户</button>
    </div>
</div>

<div class="tab_fill">
    <table class="tab_tb table table-bordered table-hover">
        <tr>
            <td class="top_bt ">账户类型</td>
            <td class="top_bt ">姓名</td>
            <td class="top_bt ">登录号码</td>
            <td class="top_bt ">权限</td>
            <td class="top_bt ">状态</td>
            <td class="top_bt ">操作</td>
        </tr>
        <tr v-for="(item,index) in lisyh">
            <td>{{item.leixing_str}}</td>
            <td>{{item.xingming}}</td>
            <td>{{item.zhanghao}}</td>
            <td>
                <div v-if="jd.isselected==1" v-for="(jd,i) in item.lisjd">{{jd.jd_name}}</div>
            </td>
            <td>{{item.zhuangtai_str}}</td>
            <td>
                <button v-if="item.zhuangtai==2" class="btn btn-xs btn-success" v-on:click="JDYHZhuangTaiP(item.id,1)">启用</button>
                <button v-if="item.zhuangtai==1" class="btn btn-xs btn-warning" v-on:click="JDYHZhuangTaiP(item.id,2)">停用</button>
                <button class="btn btn-xs btn-info" v-on:click="ModifyYHInfoP(item.id)">编辑</button>
                <button class="btn btn-xs btn-danger" v-on:click="JDYHZhuangTaiP(item.id,3)">删除</button>
            </td>
        </tr>

    </table>
</div>


<script>
    var vm = new Vue({
        el: '#app',
        data: {
            lisyh: [],

        },
        methods: {
            JDGetUserP: function () {
                $.post("/JiuDian/JDGetUserP", {}, function (res) {
                    vm.lisyh = res;
                })
            },
            JDYHZhuangTaiP: function (yhjdid, zt) {
                $.post("/JiuDian/JDYHZhuangTaiP", { yhjdid: yhjdid, zt: zt }, function (res) {
                    if (res.code > 0) {
                        vm.JDGetUserP();
                    }
                    else {
                        alert(res.msg);
                    }
                })
            },
            ModifyYHInfoP: function (yhjdid) {
                to_url('/JiuDian/JDZhangHuShow?yhjdid=' + yhjdid);
            }


        }
    })

    $(function () {
        vm.JDGetUserP();
    });
</script>